-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added EXTRA_FLAGS variable to CUDA Makefile to provide the freedom to… #28
Conversation
… specify debug flags or gencode flags
You don't need to predefine
|
might be, but that wouldn't have switched off `-O3` that was hard coded
in the Makefile stub.
|
That's true. Are you able to put the |
While I am at it, I'll align the cuda make to OpenMP.cmake although I'd
recommend using `?=` where possible. OpenMP.cmake does always set
variables directly where `?=` might offer more flexiblity.
I'll finish the CUDA.make and thus leave the door open for CUDA-with-clang.
|
What flexibility are you seeing with |
With this:
```
CXXFLAGS?=-O3 -std=c++11
GPUCXX?=nvcc
cuda-stream: main.cpp CUDAStream.cu
$(GPUCXX) $(CXXFLAGS) -DCUDA $^ $(EXTRA_FLAGS) -o $@
```
I can pitch in anything on the command line and the Makefile stays quite
concise:
```
$ CXXFLAGS="-g -G -std=c++11" make -f CUDA.cmake #produces debug output
in case I screwed up
$ make -f CUDA.cmake #produces the default -O3 binary
```
Just saying -
|
Sure, but the same is true without the
You can still override
|
NB. I still need to dig the GNU make manual.
Ha, learned something again! I checked your example with a handful of
GNU make builds:
**with `?=`**
```
$ cat testme.make
CXXFLAGS?=-std=c++11 -O3
cuda-stream: main.cpp CUDAStream.cu
nvcc ${CXXFLAGS} -DCUDA $^ $(EXTRA_FLAGS) -o $@
```
using `?=` is agnostic of the position of the variable definition:
```
$ CXXFLAGS=-bla make -f testme.make -n
nvcc -bla -DCUDA main.cpp CUDAStream.cu -o cuda-stream
$ make -f testme.make -n CXXFLAGS=-bla
nvcc -bla -DCUDA main.cpp CUDAStream.cu -o cuda-stream
```
**without `?=`**
```
$ cat testme.make
CXXFLAGS=-std=c++11 -O3
cuda-stream: main.cpp CUDAStream.cu
nvcc ${CXXFLAGS} -DCUDA $^ $(EXTRA_FLAGS) -o $@
```
Now, watch this:
~~~
$ make -f testme.make -n CXXFLAGS=-bla
nvcc -bla -DCUDA main.cpp CUDAStream.cu -o cuda-stream
$ CXXFLAGS=-bla make -f testme.make -n
nvcc -std=c++11 -O3 -DCUDA main.cpp CUDAStream.cu -o cuda-stream
~~~
See the last call? the updated value of CXXFLAGS is not used.
|
we didn't come to a conclusion on this, did we? |
Thanks for your investigation into But for the purposes of this pull request, can you pull out the |
make variable to cope with clang as CUDA compiler as well
done |
Merged, thanks for the contribution. |
Created Issue #30 for switching to |
… specify debug flags or gencode flags,
in more detail, I ran into trouble when trying to benchmark more than
arraysize = 32*1024*1024
. This is due to the fact that by default, not-gencode
flags or similar are setup for the nvcc call of the cuda GPU stream. This defaults to an SM that doesn't support an arraysize of this magnitude and hence theinit_arrays
fails with error code0xb Invalid arguments
. We had the discussion about gencodes before in #8, but the new Makefile based build system doesn't reflect the outcome of #8.